--上下求索
local shangxiaqiusuo = fk.CreateSkill {
    name = "mcdh_shangxiaqiusuo",
    tags = {Skill.Wake}
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

shangxiaqiusuo:addEffect(fk.EventPhaseStart,{
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(self) and target == player and player.phase == Player.Start and  player:usedSkillTimes(self.name, Player.HistoryGame) == 0
    end,
    can_wake = function(self, event, target, player, data)
        local room=player.room
        local mark = player:getTableMark("#mcdh_guangciyuku")
        return #room.alive_players == #table.filter(mark,function(id) return table.contains(room.alive_players,room:getPlayerById(id))  end) or player:getMark("mcdh_ammo") == 0
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local number = player:getMark("mcdh_ammo")
        lib.LoseAmmo(player,player,number,self.name)
        player:drawCards(number,self.name)
        room:handleAddLoseSkills(player, "-mcdh_guangciyuku", nil, true, false)
        room:handleAddLoseSkills(player, "mcdh_shulutonggui", nil, true, false)
    end
})

Fk:loadTranslationTable{
    ["mchd_shangxiaqiusuo"] = "上下求索",
    [":mchd_shangxiaqiusuo"] ="觉醒技,准备阶段,若你对所有角色均发动过〖光赐于苦〗,或弹药值为0,则失去所有弹药并摸等量张牌,然后失去〖光赐于苦〗,获得〖殊路同归〗。",
}
return shangxiaqiusuo